package com.itdachang.design.creatation.builder;

/**
 * 建造者模式应用场景
 *
 * StringBuilder append()
 * Swagger-ApiBuilder
 * 快速实现 Lombok-Builder模式
 * @author gcq
 * @Create 2022-02-08
 */
public class MainTest {
    public static void main(String[] args) {
        AbstractBuilder builder = new XiaoMiBuilder();

        // 建造这个手机
//        builder.customMem("16G");
//        builder.customDisk("1T");
//        builder.customCpu("骁龙8个8");
//        builder.customCam("2亿");


        // 链式建造者 swagger
        Phone phone = builder.customCpu("骁龙8个8")
                .customCam("2亿")
                .customDisk("1T")
                .customMem("16G")
                .getProduct();
        System.out.println(phone);

        Phone build = Phone.builder()
                .cpu("1")
                .mem("2")
                .cam("3")
                .disk("4")
                .build();
        System.out.println(build);
    }
}